/** \file Trace.cc
 * Definitions for Trace class.
 *
 * (c) Copyright Semih Cemiloglu
 * All rights reserved, see COPYRIGHT file for details.
 *
 * $Id: Trace.cc,v 1.3 2008/06/19 06:48:08 semihc Exp $
 *
 *
 */

#include "Trace.hh"
#include <iostream>
#include "TraceMgr.hh"
#include "Debug.hh"

using namespace std;
using namespace TC;


// STATIC MEMBERS
TC_VOLATILE bool Trace::s_GlobalEnable = true;
TC_THREAD_LOCAL bool Trace::s_ThreadEnable = true;


namespace TC {

void TraceEnter(const Trace* t)
{
  if(Trace::s_GlobalEnable && Trace::s_ThreadEnable) {
    TC_LOG_INFO(">>" << *(t->m_ctx));
    TraceMgr::GetInstance().traceEnter(t);
  }
}

void TraceExit(const Trace* t)
{
  if(Trace::s_GlobalEnable && Trace::s_ThreadEnable) {    
    TC_LOG_INFO("<<" << *(t->m_ctx));
    TraceMgr::GetInstance().traceExit(t);
  }
}

} // end namespace
